package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name="OFFERDETAIL")
public class OfferDetail {
    private long proId;
    private double proMoney;
    private String proDiscount;
    private double proPrice;
    private Cart cartByCartId;
    private Offer offerByOfferId;

    @Basic
    @Column(name = "pro_discuont")
    public String getProDiscount() {
        return proDiscount;
    }

    public void setProDiscount(String proDiscount) {
        this.proDiscount = proDiscount;
    }

    @Basic
    @Column(name = "pro_price")
    public double getProPrice() {
        return proPrice;
    }

    public void setProPrice(double proPrice) {
        this.proPrice = proPrice;
    }

    @Id
    @Column(name = "pro_id")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getProId() {
        return proId;
    }

    public void setProId(long proId) {
        this.proId = proId;
    }

    @Basic
    @Column(name = "pro_money")
    public double getProMoney() {
        return proMoney;
    }

    public void setProMoney(double proMoney) {
        this.proMoney = proMoney;
    }

    @ManyToOne
    @JoinColumn(name = "cart_id", referencedColumnName = "cart_id")
    public Cart getCartByCartId() {
        return cartByCartId;
    }

    public void setCartByCartId(Cart cartByCartId) {
        this.cartByCartId = cartByCartId;
    }

    @ManyToOne
    @JoinColumn(name = "offer_id", referencedColumnName = "offer_id")
    public Offer getOfferByOfferId() {
        return offerByOfferId;
    }

    public void setOfferByOfferId(Offer offerByOfferId) {
        this.offerByOfferId = offerByOfferId;
    }
}
